package com._23DesignPattern._create.Singleton;

/**
 * @Author: huangya
 * @Date: 2019/3/2
 * @Description: 静态内部类单例
 */
public class SingletonDemo3 {

    private SingletonDemo3() {
        System.out.println("构造方法 SingletonDemo3()");
    }

    public static SingletonDemo3 getInstance() {
        System.out.println("getInstance()");
        return SingletonInstance.INSTANCE;
    }



    private static class SingletonInstance {
        private static final SingletonDemo3 INSTANCE = new SingletonDemo3();

        public SingletonInstance() {
            System.out.println("SingletonDemo3.SingletonInstance.SingletonInstance()");
        }
    }


}
